<script>
import { serveConfig } from '@/js/config/index.js'
import Axios from '@/utils/request.js'
export default {
	onLaunch: function () {
		this.getRegion()
	},
	onHide: function () {
		console.log('App Hide')
	},
	globalData: {
		ossUrl: 'https://ty-yd.oss-cn-beijing.aliyuncs.com/static_cinema',
		serverUrl: serveConfig.baseUrl,
		userInfo: {},
		questionList: [], //答题列表
		countryData: [], //国家列表
		regionData: [], //地区列表
		cityData: [], //城市列表
		signInfo: {} //报名信息
	},
	methods: {
		navTo(url) {
			uni.navigateTo({
				url: url
			})
		},
		// 地区列表
		getRegion(rid = 0) {
			return new Promise((resolve, reject) => {
				/* prettier-ignore */
				Axios.request(false, 'get', { 
					url: '/race/common/region/'+rid,
				}, (res) => {
					this.globalData.regionData = res.data
					resolve(res.data)
				},err=>{
					reject()
				})
				/* prettier-ignore */
			})
		},
		// 城市列表
		getCity(pid) {
			return new Promise((resolve, reject) => {
				/* prettier-ignore */
				Axios.request(false, 'get', { 
					url: '/race/common/region/'+pid
				}, (res) => {
					this.globalData.cityData = res.data
					resolve(res.data)
				},err=>{
					reject()
				})
				/* prettier-ignore */
			})
		}
	}
}
</script>

<style lang="scss">
/* 注意要写在第一行，同时给style标签加入lang="scss"属性 */
@import 'uview-ui/index.scss';
@import '@/static/css/common.scss';
.flex-between {
	display: flex;
	justify-content: space-between;
	align-items: center;
}
.flex-align {
	display: flex;
	align-items: center;
}
.flex-center {
	display: flex;
	align-items: center;
	justify-content: center;
}
.clear {
	clear: both;
	height: 0;
	overflow: hidden;
}
.u-loadmore {
	padding-bottom: 20rpx;
	margin-bottom: 0;
}
</style>
